package com.niguang.work.api.vo;

import lombok.Data;

import java.util.TreeMap;

@Data
public class WechatTemplateMsg {


    /**
     * 接收者openid
     */
    private String touser;

    /**
     * 模板ID
     */
    private String template_id;

    private String form_id;

    /**
     * 公众号模板跳转链接
     */
    private String url;

    /**
     * 跳转小程序参数路由
     */
    private Miniprogram miniprogram;


    /**
     * data数据
     */
    private TreeMap<String, TreeMap<String, String>> data;

    /**
     * 参数
     *
     * @param value
     * @param color 可不填
     * @return
     */
    public static TreeMap<String, String> item(String value, String color) {
        TreeMap<String, String> params = new TreeMap<>();
        params.put("value", value);
        params.put("color", color);
        return params;
    }

    @Data
    public static class Miniprogram {

        /**
         * 小程序appId
         */
        private String appid;

        /**
         * 跳转小程序链接：index?foo=bar
         */
        private String pagepath;

        public Miniprogram() {
        }

        public Miniprogram(String appid, String pagepath) {
            this.appid = appid;
            this.pagepath = pagepath;
        }
    }

}
